# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=apk-polkit
pkgver=0.6.1
_distsha=e8f1846b37d8f560a36028a49d5de398
pkgrel=0
pkgdesc="A Polkit helper for apk, the Alpine Package Keeper"
url="https://gitlab.alpinelinux.org/Cogitri/apk-polkit"
# SIGSEGV on x86
arch="x86_64 aarch64" # ldc
license="GPL-3.0-or-later"
makedepends="meson polkit-d-dev openssl-d-dev apk-tools-d-dev>=2.10.5.8
	ldc ldc-runtime glibd-dev lld lua5.3-lzlib lua5.3"
checkdepends="bash py3-dbusmock dbus dbus-x11"
subpackages="$pkgname-static $pkgname-dev $pkgname-dbg"
source="https://gitlab.alpinelinux.org/Cogitri/apk-polkit/uploads/$_distsha/apk-polkit-$pkgver.tar.xz"

build() {
	# Needs lld as linker, see: https://github.com/mesonbuild/meson/issues/6987
	DFLAGS="--linker=lld" meson \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--buildtype=plain \
		. output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

check() {
	meson test --no-rebuild -v -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="7c3e1f30e09a09cb485f4a6542ae6dc4a8dcf6dbf46000aecbe72694ca3dad4297b199e237bb77d6d5614de45f017c7fe0c308cbd5c2b07da16b574921fc25ec  apk-polkit-0.6.1.tar.xz"
